<?php
function __autoload($class){
	require_once '../'.$class.'.php';
}
$dbconnect = new DBconnect();
require_once 'adminHeader.php';
?>
	<script type="text/javascript">
		function confirmDeleteTeam(){
			$confirm = $confirm = confirm("Are you sure want to delete " + document.getElementById("deleteteam").value+"?");
			return $confirm;
		}
	</script>
	<form action='<?php echo $_SERVER['PHP_SELF']; ?>' method='post' onsubmit='confirmDeleteTeam()'>
		<table>
			<th>Delete Team</th>
			<tr>
				<td>Select Team</td>
				<td><select name='deleteteam' id='deleteteam'>
				<?php 
				$dbconnect->selectAllRealTeams();
				?>	
				</select></td>
			</tr>
			<tr>
				<td></td>
				<td><input type='submit' name='submit' value='Delete Team'></td>
			</tr>
		</table>
	</form>
	<?php 
		if(isset($_POST['submit'])){
			$dbconnect->deleteRealTeam($_POST['deleteteam']);
			echo $_POST['deleteteam']." is successfully deleted from database!";
		}
		require_once 'adminFooter.php';
	?>
